package auth

import (
	configs "galaxy-manage/internal/config"
	"galaxy-manage/internal/pkg/core"
	"galaxy-manage/internal/repository/mysql"
	"galaxy-manage/internal/repository/redis"
	"galaxy-manage/internal/services/auth"
	"galaxy-manage/pkg/hash"
	"go.uber.org/zap"
)

var _ Handler = (*handler)(nil)

type Handler interface {
	i()
	GetCaptcha() core.HandlerFunc
	Login() core.HandlerFunc
}

type handler struct {
	logger      *zap.Logger
	cache       redis.Repo
	hashids     hash.Hash
	authService auth.Service
}

func New(logger *zap.Logger, db mysql.Repo, cache redis.Repo) Handler {
	h := handler{
		logger:      logger,
		cache:       cache,
		hashids:     hash.New(configs.Get().HashIds.Secret, configs.Get().HashIds.Length),
		authService: auth.New(db, cache),
	}
	return &h
}

func (h *handler) i() {}
